package com.mingmen.supplier.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.mingmen.supplier.R;
import com.mingmen.supplier.activity.CommodityServiceListActivity;
import com.mingmen.supplier.activity.GongNoticeListActivity;
import com.mingmen.supplier.activity.LoginActivity;
import com.mingmen.supplier.activity.NoticeListActivity;
import com.mingmen.supplier.util.SharePreferenceUtil;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;


public class PersonalFragment extends Fragment {
    @BindView(R.id.text_return)
    TextView textReturn;
    @BindView(R.id.linear_return)
    LinearLayout linearReturn;
    @BindView(R.id.text_Order)
    TextView textOrder;
    @BindView(R.id.layout_toolbar)
    RelativeLayout layoutToolbar;
    @BindView(R.id.layout_notice)
    LinearLayout layoutNotice;
    @BindView(R.id.layout_peizhi)
    LinearLayout layoutPeizhi;
    @BindView(R.id.layout_contact)
    LinearLayout layoutContact;
    Unbinder unbinder;
    @BindView(R.id.btn_login)
    Button btn_login;

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_personal, null);


        unbinder = ButterKnife.bind(this, view);
        return view;
//        return super.onCreateView(inflater, container, savedInstanceState);
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }

    @OnClick({R.id.layout_notice, R.id.layout_peizhi, R.id.layout_contact,R.id.btn_login})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.layout_notice:
                startActivity(new Intent(getActivity(), NoticeListActivity.class));

                break;
            case R.id.layout_peizhi:
                startActivity(new Intent(getActivity(), CommodityServiceListActivity.class));
                break;
            case R.id.layout_contact:
                break;
            case R.id.btn_login:
                getActivity().finish();
                SharePreferenceUtil.clear(getActivity());
                startActivity(new Intent(getActivity(), LoginActivity.class));
                break;
        }
    }
}
